import javax.swing.plaf.synth.SynthEditorPaneUI;
import java.util.Arrays;
import java.util.Random;

/**
 * @User: vitobo
 * @Date: 2024-06-27
 * @Description: 排序学习
 *
 */
public class Test {

    public static void testInsert(int[] array){
        array = Arrays.copyOf(array, array.length);
        long start = System.currentTimeMillis();
        TestSort.insertSort(array);
        long end = System.currentTimeMillis();
        System.out.println("插入排序耗时: " + (end - start));
    }


    /**
     *  将数组 当中 初始化为有序的数据
     * @param array
     */
    public static void initOrder(int[] array){
        for (int i = 0; i < array.length; i++) {
            array[i] = array.length-i;
        }
    }

    public static void initNotOrder(int[] array){
        Random random = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = random.nextInt(10_0000);
        }
    }


    public static void main(String[] args) {
        int[] array = {1,13,5,8,2,34,25};
        System.out.println("排序前: " + Arrays.toString(array));

        //TestSort.insertSort(array);
        //TestSort.shellSort(array);
        //TestSort.selectSort(array);
        //TestSort.heapSort(array);
        //TestSort.bubbleSort(array);
        //TestSort.quickSort(array);
        //TestSort.mergeSort(array);
        TestSort.countSort(array);

        System.out.println("排序后: " + Arrays.toString(array));

    }
}
